package com.atguigu.tingshu.dispatch.job;

import com.atguigu.tingshu.search.client.SearchFeignClient;
import com.atguigu.tingshu.user.client.UserFeignClient;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class DispatchHandler {

    @Autowired
    private SearchFeignClient searchFeignClient;

    @Autowired
    private UserFeignClient userFeignClient;

    @XxlJob("firstJobHandler")
    public void firstJobHandler() {
        log.info("xxl-job项目集成测试");
    }

    @XxlJob("updateHotAlbumJob")
    public void updateHotAlbumJob() {
        searchFeignClient.updateLatelyAlbumRanking();
        log.info("更新热门专辑");
    }

    @XxlJob("updateVipExpireStatus")
    public void updateVipExpireStatus() {
        userFeignClient.updateVipExpireStatus();
        log.info("更新热门专辑");
    }

}